using System;
using Rilisoft;

[Serializable]
public class Bullets
{
	public string nameWeapon = string.Empty;

	private bool bulletSave;

	private SaltedInt startBulletCount = new SaltedInt(13584955);

	private SaltedInt bulletPackCount = new SaltedInt(11883947);

	private SaltedInt bulletAllCount = new SaltedInt(13576763);

	public bool needReload;

	public int StartBulletCount
	{
		get
		{
			return startBulletCount.Value;
		}
		set
		{
			startBulletCount.Value = value;
		}
	}

	public int BulletPackCount
	{
		get
		{
			return bulletPackCount.Value;
		}
		set
		{
			bulletPackCount.Value = value;
		}
	}

	public int BulletAllCount
	{
		get
		{
			return bulletAllCount.Value;
		}
		set
		{
			bulletAllCount.Value = value;
		}
	}

	public Bullets(int bulletCountToPack, int allCount, bool isSave = false)
	{
		bulletSave = isSave;
		BulletPackCount = bulletCountToPack;
		BulletAllCount = allCount;
		StartBulletCount = allCount;
	}

	public void minusOneBullet()
	{
		if (getCurrentBulletsToPack() == 1)
		{
			needReload = true;
		}
		BulletAllCount--;
	}

	public void reloadBullets()
	{
		needReload = false;
	}

	public int getRestBullets()
	{
		int num = BulletPackCount * (BulletAllCount / BulletPackCount);
		if (!needReload && num == BulletAllCount)
		{
			num -= BulletPackCount;
		}
		return num;
	}

	public int getCurrentBulletsToPack()
	{
		return BulletAllCount - getRestBullets();
	}

	public string getCountBullets()
	{
		return getCurrentBulletsToPack() + "/" + getRestBullets();
	}

	public string getCountBulletsForDoubleHanded(bool increaseVisibleBulletCount = false)
	{
		int num = getCurrentBulletsToPack() * 2;
		if (increaseVisibleBulletCount)
		{
			num++;
		}
		return num + "/" + getRestBullets() * 2;
	}

	public string getCountBulletsOnly()
	{
		return string.Empty + BulletAllCount;
	}

	public void ResetCountBullet()
	{
		if (!bulletSave)
		{
			BulletAllCount = StartBulletCount;
			needReload = false;
		}
	}
}
